﻿using Cofe.Core.Dynamic;
using Cofe.Core.Implements;
using Cofe.Core.Property;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;

namespace Cofe.Core.Entry
{


    public class AutoEntryList : EntryList, IAutoEntryList
    {
        #region Constructor

        public AutoEntryList(IPropertyHost properties, IDynamicPropertyInterfaceProvider[] providers)
            : base(properties, providers)
        {
        }

        public AutoEntryList(IPropertyHost properties)
            : base(properties)
        {

        }

        protected AutoEntryList()
            : base()
        {

        }
        #endregion

        #region Methods

        public async Task SearchAsync(ParameterDic parameters = null)
        {
            await Properties.Behaviors.InvokeAsync(CofeEntryListProperties.SearchAsync, parameters);
        }

        #endregion

        #region Data

        #endregion

        #region Public Properties

        public string EntryFilterString
        {
            get
            {
                return Properties.Behaviors.TryGetProperty<string>(CofeEntryListProperties.FilterString);
            }
            set
            {
                Properties.Behaviors.SetProperty(CofeEntryListProperties.FilterString, value);
            }
        }

        #endregion

    }

    public class CustomEntryList : EntryList, ICustomEntryList
    {
        #region Constructor

        public CustomEntryList(IPropertyHost properties, IDynamicPropertyInterfaceProvider[] providers)
            : base(properties, providers)
        {
        }

        public CustomEntryList(IPropertyHost properties)
            : base(properties)
        {

        }

        protected CustomEntryList()
            : base()
        {

        }
        #endregion

        #region Methods


        #endregion

        #region Data

        #endregion

        #region Public Properties

        [NotMapped]
        public bool IsAttached
        {
            get { return Properties.Behaviors.TryGetProperty<bool>(CofeEntryListProperties.IsAttached); }
        }

        #endregion

    }

}
